﻿using System;
using System.Web.UI;
using UDS.Components;
using UDS.Entity;

namespace UDS.SubModule.UnitiveDocument
{
    public partial class SwitchPage : Page
    {
        protected override void OnInit(EventArgs e)
        {
            JumpPage();
            base.OnInit(e);
        }

        private void JumpPage()
        {
            var newClass = new Class();
            int action = QSUtil.GetInt32("Action", 0);
            int classID = QSUtil.GetInt32("ClassID", 0);

            SiteContext.Current.ActiveNodeID = classID;
            if (action == 0)
            {
                Response.Redirect("Document/DeliverDocument.aspx?ClassID=" + classID);
                return;
            }

            if (action == 1)
            {
                ClassType classtype = Class.GetClassType(classID);
                switch (classtype)
                {
                    case ClassType.Project:
                        Response.Redirect("Project.aspx?classID=" + classID);
                        break;
                    case ClassType.MyDoc:
                        Response.Redirect("Document/ListView.aspx?classID=" + classID);
                        break;
                    //case "2":
                    //    break;
                    case ClassType.BBS:
                        Response.Redirect("BBS/Catalog.aspx?classID=" + classID);
                        break;
                    case ClassType.StaffManagement:
                        Response.Redirect("../Staff/ManageStaff.aspx?DisplayType=0");
                        break;
                    case ClassType.HelpPage:
                        Response.Redirect("Task/Listview.aspx");
                        break;
                    case ClassType.MyTask:
                        Response.Redirect("../Schedule/TaskList.aspx");
                        break;
                    case ClassType.Mail:
                        Response.Redirect("Mail/Index.aspx?classID=" + classID);
                        break;
                    case ClassType.NewDoc:
                        Response.Redirect("NewDoc/Listview.aspx");
                        break;
                    case ClassType.DocFlow:
                        Response.Redirect("DocumentFlow/ListDocument.aspx");
                        break;
                    case ClassType.ClientManagement:
                        Response.Redirect("../CM/ClientListview.aspx");
                        break;
                    case ClassType.MyLinkman:
                        Response.Redirect("../LinkMan/Listview.aspx");
                        break;
                    case ClassType.Position:
                        Response.Write("<script laguage='javascript'>parent.location='../position/index.htm';</script>");
                        break;
                    case ClassType.RoleManagement:
                        Response.Write("<script laguage='javascript'>parent.location='../role/Index.aspx';</script>");
                        break;
                    case ClassType.WorkAttendance:
                        Response.Redirect("../WorkAttendance/SearchData.aspx");
                        break;
                    case ClassType.WorkAttendanceManagement:
                        Response.Redirect("../WorkAttendance/Set.aspx");
                        break;
                    case ClassType.Message:
                        Response.Redirect("../SM/Index.aspx");
                        break;
                    case ClassType.USBKey:
                        Response.Redirect("../USBKey/USBKey_setup.aspx");
                        break;
                    //case "100":
                    //    Response.Redirect("ManageQuery/ManageQuery.aspx");
                    //    break;
                    case ClassType.CommonFile:
                        Response.Redirect("~/SubModule/CF/FileList.aspx");
                        break;

                    case ClassType.PersonalFile:
                        Response.Redirect("~/SubModule/PersonalFile/FileList.aspx");
                        break;
                }
            }
            //Response.Write(action+","+classID+","+classtype);
        }
    }
}